import java.io.*;
import java.net.*;
import java.util.HashMap;
import java.util.Map;

public class ChatClient {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("localhost", 12345);
        PrintWriter writer = new PrintWriter(socket.getOutputStream(), true);
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String message;

//        System.out.println(socket.toString());
        System.out.println(socket.getLocalAddress());

        while ((message = reader.readLine()) != null) {
            writer.println(message);
        }


    }
}
